package org.eclipse.football;

import static org.junit.Assert.*;

import org.junit.Test;

public class SemiDuplicatePlayers {

	@Test
	public void test() {
		// Create a team
		Team team = new Team("team", "user");
		
		// Create two offensive players with identical names but different teams
		OffPlayer off_player1 = new OffPlayer("off_player", "team1");
		OffPlayer off_player2 = new OffPlayer("off_player", "team2");
		
		// Get number of offensive players
		int old_size = team.getOff_players().size();
		
		// Try to add both offensive players to team
		team.addOffPlayer(off_player1);
		team.addOffPlayer(off_player2);
		
		// Make sure number of offensive players increased by two
		assertEquals(old_size + 2, team.getOff_players().size());
		
		// Create two defensive players with identical names but different teams
		DefPlayer def_player1 = new DefPlayer("def_player", "team1");
		DefPlayer def_player2 = new DefPlayer("def_player", "team2");
		
		// Get number of defensive players
		old_size = team.getDef_players().size();
		
		// Try to add both defensive players to team
		team.addDefPlayer(def_player1);
		team.addDefPlayer(def_player2);
		
		// Make sure number of defensive players increased by two
		assertEquals(old_size + 2, team.getDef_players().size());
		
		// Create two kickers with identical names but different teams
		Kicker kicker1 = new Kicker("kicker", "team1");
		Kicker kicker2 = new Kicker("kicker", "team2");
		
		// Get number of kickers
		old_size = team.getKickers().size();
		
		// Try to add both kickers to team
		team.addKicker(kicker1);
		team.addKicker(kicker2);
		
		// Make sure number of kickers increased by two
		assertEquals(old_size + 2, team.getKickers().size());
		
	}

}
